# 自动化步骤
# 安装 selenium库
import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# 创建驱动对象
driver = webdriver.Edge()
# 打开网页
driver.get("file:///D:/pagetest/注册A.html")
# 最大化窗口 必须记住
driver.maximize_window()

# click()  点击元素
# send_keys(value)  输入键盘信息
# clear()   清空文本
# 获取元素的文字信息 text,必须记住,以后自动化做判断用
# 文字信息指的是元素里黑色的字体
# 获取新浪
ele = driver.find_element(By.CSS_SELECTOR,'#fw')
print(ele.text)
# 定位账号，输入王宝强
# driver.find_element(By.CSS_SELECTOR,'#userA').send_keys('王宝强')
# time.sleep(3)
# 清空账号输入框里的内容
# driver.find_element(By.CSS_SELECTOR,'#userA').clear()
# # 点击香蕉
# driver.find_element(By.CSS_SELECTOR,'#xja').click()
# # 点击购物
# driver.find_element(By.CSS_SELECTOR,'#gwA').click()
# 输入用户名admin
# driver.find_element(By.CSS_SELECTOR,'#userA').send_keys('admin')
# # 输入密码123456
# driver.find_element(By.CSS_SELECTOR,'#passwordA').send_keys('123456')
# # 电话号码123456789
# driver.find_element(By.CSS_SELECTOR,'#telA').send_keys('123456789')
# time.sleep(3)
# # 间隔三秒清空用户名
# driver.find_element(By.CSS_SELECTOR,'#userA').clear()
# # 用户名user
# driver.find_element(By.CSS_SELECTOR,'#userA').send_keys('user')
# time.sleep(3)
# # 间隔三秒清空电话号码
# driver.find_element(By.CSS_SELECTOR,'#telA').clear()
# # 电话号码18687654321
# driver.find_element(By.CSS_SELECTOR,'#telA').send_keys('18687654321')
# time.sleep(3)
# # 间隔三秒点击注册按钮
# driver.find_element(By.CSS_SELECTOR,'body > div.zc > fieldset > form > p:nth-child(5) > button').click()
# 关闭网页
time.sleep(123)
























